//
//  LSZAudioDetailsTableViewCell.m
//  PartyClassCloud
//
//  Created by 梁素珍 on 2018/8/30.
//  Copyright © 2018年 九酷. All rights reserved.
//

#import "LSZAudioDetailsTableViewCell.h"

@implementation LSZAudioDetailsTableViewCell

-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.imageViewCover = [[UIImageView alloc]init];
        self.imageViewCover.frame = CGRectMake(10, (100-50)/2, 50, 50);
        [self.imageViewCover.layer setMasksToBounds:YES];
        [self.imageViewCover.layer setCornerRadius:self.imageViewCover.frame.size.height/2];
        [self addSubview:self.imageViewCover];
        
        self.labelTitle = [[UILabel alloc]init];
        self.labelTitle.frame = CGRectMake(CGRectGetMaxX(self.imageViewCover.frame)+10, 15, ScreenWidth-CGRectGetMaxX(self.imageViewCover.frame)-25, 40);
        self.labelTitle.textColor = titleColorLSZ;
        self.labelTitle.font = FONT_(15);
        self.labelTitle.numberOfLines = 0;
        [self addSubview:self.labelTitle];
        
        self.labelTime = [[UILabel alloc]init];
        self.labelTime.frame = CGRectMake(CGRectGetMaxX(self.imageViewCover.frame)+15, CGRectGetMaxY(self.labelTitle.frame), ScreenWidth-CGRectGetMaxX(self.imageViewCover.frame)-25, 18);
        self.labelTime.textColor = lightColor;
        self.labelTime.font = FONT_(13);
        [self addSubview:self.labelTime];
        
    }
    return self;
}
-(void)setTertiaryInterfaceMg:(LSZTertiaryInterfaceMg *)tertiaryInterfaceMg
{
    [self.imageViewCover sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",URLTotal,tertiaryInterfaceMg.coverUrl]] placeholderImage:[UIImage imageNamed:@"默认"]];
    self.labelTitle.text = tertiaryInterfaceMg.name;
    self.labelTime.text = tertiaryInterfaceMg.publishTime;
    
    CGFloat height = [LSZSpecialPackaging getHeightOfText:ScreenWidth-CGRectGetMaxX(self.imageViewCover.frame)-25 height:ScreenHeight font:15 :tertiaryInterfaceMg.name];
    CGRect rect = self.labelTitle.frame;
    rect.size.height = height;
    self.labelTitle.frame = rect;
    
    CGRect rectOne = self.labelTime.frame;
    rectOne.origin.y = CGRectGetMaxY(self.labelTitle.frame);
    self.labelTime.frame = rectOne;
    
    CGFloat heightTotal = 15+height+18+15;
    CGRect rectImageView = self.imageViewCover.frame;
    rectImageView.origin.y = (heightTotal-self.imageViewCover.frame.size.height)/2;
    self.imageViewCover.frame = rectImageView;
}
@end
